// a change here


'use strict';

var http = require("http"); 
var url = require("url");
var querystring = require("querystring"); 

 	  


function start(routing){
	
	function callback(request, response) {  
		console.log(request.url);
		var pathname = url.parse(request.url).pathname;
		
		console.log("Die Anfrage war für den Pfad: " +pathname);  
		console.log("Die zweite Ankündigung muß '"
+querystring.parse(url.parse(request.url).query)["Abfragekette2"]+"' sein."); 
		
		routing(pathname,response);

		response.writeHead(200, {"Content-Type": "text/html"});
		response.write("<html><body>ALTE WEBSEITE!");
		response.write("Den zweiten Teil gebe ich!");
		response.write(pathname);
		response.write("</body></html>");
		response.end();
	}
	
	var port=1337;
	http.createServer( callback ).listen(port); 
	console.log("Der Httpdiener fing am "+port+" an.");
}

exports.start = start;


